<template>
  <div>
    <button @click="show = !show">显示/隐藏</button>
    <transition>
      <div class="box" v-if="show">看我</div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      show: true,
    };
  },
};
</script>

<style scoped>
.box {
  width: 100px;
  height: 100px;
  background: yellowgreen;
}
</style>
